/* 
 Project     : 48c6c450f1a4a0cc53d9585dc0fee742
 Created on  : Mar 16, 2013, 11:29:15 PM
 Author      : Truong Khuong - khuongxuantruong@gmail.com
 Description :
 Purpose of the stylesheet follows.
 */
var _CONFIG = {
    JQXGRID_ELEMENT: '#jqxGrid_Backend_Categories',
    CATE_PARENT: '',
    BINDING_URI: base_url + 'backend/request/contact_binding/',
    EDIT_PANEL_URI: base_url + "backend/request/editpanel",
    EDIT_PANEL_URI2: base_url + "backend/request/editpanel",
    COMMIT_URI: base_url + "backend/wallpaper/Commit",
    DELETE_URI: base_url + "backend/excution/delete/contact/contact/cont",
    PENDING: false,
    PAGE: 0,
    PAGESIZE: 20
};
var _REQUEST = (function() {
    var init = false;
    return {
        LoadData: function(_page) {
            _CONFIG.PAGE = _page;
            $('.loading').show();
            $('#requestDataList').load(_CONFIG.BINDING_URI, {
                pagenum: _CONFIG.PAGE,
                pagesize: _CONFIG.PAGESIZE
            }, function() {
                $.jGrowl('Load Data Success !');
                $('.loading').hide();
            });
        },
        OnInit: function() {
            try {
                if (init)
                    return;
                init = true;
                //grid_element=$('#jqxGrid_Backend_Categories');
                this.LoadData(_CONFIG.PAGE);

            } catch (e) {
                $.jGrowl(e.message, {sticky: true, theme: 'growl-error', header: 'Error!'});
            }
        },
        AddItem: function() {
            this.EditItem(0);
        },
        AddItemIn: function() {
            this.EditItemIn(0);
        },
        OtherAdvand: function() {
            $('.otheradvand').toggle();
        },
        Cancel: function() {
            $('#_form_edit_panel').parents('.bootbox').modal('hide');
        },
        CancelIn: function() {
            $('#viewport_REQUEST').show();
            $('#_edit_panel_insite').hide().html('');
        },
        DeleteItem: function(id) {
            backend_delete(base_url+'backend/excution/delete/contact/contact/cont',id,function(){
                _REQUEST.Refresh();
            });
        },
        RestoreItem: function() {
            accessdenied();
        },
        Permission: function(id) {

        },
        PrivateItem: function() {
            accessdenied();
        },
        Setting: function() {
            bckdialog({
                message: $('#window-sOpt'),
                icon: "<img class='p-a t-7 l-8' src='" + base_url + "/libraries/images/16/option.gif'/>",
                title: 'Setting'
            }).open();
        },
        Refresh: function() {
            this.LoadData(_CONFIG.PAGE);
        }
    };
}());
$(document).ready(function() {
    //Btree().Init();
});